import Vue from 'vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './App.vue'
import router from './router'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import './components/Home.vue'
import ContentBox from './components/mycom/ContentBox.vue'
import Treetable from 'vue-table-with-tree-grid'
import Nprogress from "nprogress"
import "../node_modules/nprogress/nprogress.css"

Vue.component('content-box', ContentBox)
Vue.component('tree-table', Treetable)
Vue.prototype.$http = axios

//配置请求根路径
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
//axios请求拦截inter
axios.interceptors.request.use(config => {
    //开启进度条
    Nprogress.start()
    console.log(config);
    config.headers.Authorization = window.sessionStorage.getItem('token')
    //在最后必须return config
    return config
})
//响应拦截器
axios.interceptors.response.use(res => {
    //终止进度条
    Nprogress.done()

    return res
})


Vue.config.productionTip = false
Vue.use(ElementUI)

new Vue({
    //把路由挂载到Vue根实例中
    router,
    render: h => h(App)
}).$mount('#app')
